<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('抽检详情列表')"/>
    <style>
        .send-content-wrap {
            white-space: pre-line;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">

            <form id="job-form">
                <div class="select-list">
                    <input type="hidden" id="batchCode" name="batchCode" th:value="${batchCode}">

                    <ul>
                        <li>
                            客户id：<input type="text" name="custId"/>
                        </li>
                        <li>
                            订阅id：<input type="text" name="unionId"/>
                        </li>
                        <li>
                            发送状态：<select name="sendStatus" th:with="type=${@dict.getType('send_job_status_type')}">
                            <option value="">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-responsive">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var sendJobStatusType = [[${@dict.getType('send_job_status_type')}]];
    var prefix = ctx + "data/sampling/mot";

    $(function () {
        var options = {
            url: prefix + "/detail/list/"+$("#batchCode").val(),
            detailUrl: prefix + "/detail/{id}",
            sortName: "createDate",
            sortOrder: "desc",
            modalName: "mot数据抽检详情",
            columns: [
                /*				{
                                checkbox: true
                                },*/
                {
                    field: 'id',
                    title: '主键',
                    visible:false
                },
                {
                    field: 'custId',
                    title: '客户id'
                },                {
                    field: 'unionId',
                    title: '订阅id'
                },
                {
                    field: 'nodeId',
                    title: '节点编码'
                },
                {
                    field: 'templateId',
                    title: '模版编码'
                },
                {
                    field: 'content',
                    title: '内容',
                    formatter: function(value, row, index) {
                        return '<div class="send-content-wrap">' + value + '</div>';
                    }
                },
                {
                    field: 'sendStatus',
                    title: '发送任务状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(sendJobStatusType,value);
                    }
                },
                {
                    field: 'createDate',
                    title: '生成日期',
                    sortable: true
                },
                {
                    field: 'updateTime',
                    title: '更新时间',
                    sortable: true
                },
/*                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '"href="javascript:void(0)" onclick="detail(\''+ row.batchCode +'\')"><i class="fa fa-search"></i>发送详情</a> ');
                        actions.push('<a class="btn btn-primary btn-xs ' + batchSendFlag + '" href="javascript:void(0)" onclick="batchSend(\'' + row.batchCode + '\',\''+row.sendStatus+'\')"><i class="fa fa-play-circle-o"></i>批量发送</a> ');
                        return actions.join('');
                    }
                }*/
                ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>